<% response.setHeader("X-UA-Compatible","IE=edge"); %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>设备信息管理平台</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<%=basePath%>images/syzzicon.ico">
<link rel="stylesheet" href="<%=basePath%>css/syzzmain.css"  type="text/css" media="screen" />
<link rel="stylesheet" href="<%=basePath%>css/font-awesome.css" type="text/css" media="screen" />
<%-- <script type="text/javascript" src="<%=basePath%>js/jquery-1.11.3.js"></script> --%>
<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery-1.8.2.js"></SCRIPT>


<link rel="stylesheet" href="<%=basePath%>ztree/css/css/zTreeStyle/zTreeStyle.css"
	type="text/css">

<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery.ztree.all-3.4.js"></SCRIPT>
















<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery.ztree.core-3.4.js"></SCRIPT>
<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery.ztree.excheck-3.4.js"></SCRIPT>
<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery.ztree.exedit-3.4.js"></SCRIPT>
<SCRIPT language=javascript src="<%=basePath%>ztree/js/jquery.ztree.exhide-3.4.js"></SCRIPT>
</head>
<body>


  
 <div class="zTreeDemoBackground left"  id="authority" style="width: 300px;" >  
	<ul id="user_tree" class="ztree" style="border: 1px solid #617775;overflow-y: scroll;height: 300px;"></ul>  
</div> 

<input type="button" value="niha" onclick="a()">

<script type="text/javascript">

var zTree;  
$(document).ready(function(){
	var set = {
			check:{  
		        chkStyle: "checkbox",
		        enable: true  
		    },  
			   data: {  
			        simpleData: {//简单数据模式  
			            enable:true,  
			            idKey: "id",  
			            pIdKey: "pid",  
			            rootPId: ""  
			        }  
			    }
	};
	 var url="ztreejson.action";
	$.ajax({
		url :url,
		type:"post",
		dataType : "json",
		success : function(zNodes) {
			t = $.fn.zTree.init($("#user_tree"), set, zNodes);
		}
	}); 
	
});


function a(){
	alert(1);
	var treeObj = $.fn.zTree.getZTreeObj("user_tree");
	
	//treeObj.val("11");
	
	
	var nodes = treeObj.getCheckedNodes(true);
	
	
	
	alert(nodes[1].name);
	
	console.info(nodes);

	var theArray=[];
	for (var i=0;i<nodes.length;i++){
		
		 theArray.push(nodes[i].id);
		
	}
	var ids=theArray.toString();
	alert(ids);
	
}



/* console.info(zNodes);
var zNodes =[
{id:4, pid:0, name:"111", open:false, nocheck:true},
{id:41, pid:4, name:"111", open:false, nocheck:true},
{id:42, pid:4, name:"111", open:false, nocheck:true},
{id:43, pid:4, name:"111", open:false, nocheck:true},
{id:44, pid:41, name:"111"},
{id:45, pid:42, name:"111"},
{id:46, pid:43, name:"111"}

]; */
</script>
</body>
</html>

